package com.woniuxy.simple;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: 曾令忠
 * @Description:消费者
 * @Date: 2020/7/4 0004-下午 4:12
 */
@Component
public class Consumer {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    //监听，订阅指定的消息队列，只要队列中有消息就会调用方法进行处理
    @RabbitListener(queues = "hello")
    public void receive(String msg){
        System.out.println("1接收到的消息："+msg);
    }
}
